﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TreatmentMaintenanceDomainService.cs" company="ELEN 7045 GROUP II">
//    Contributed by E.Vosloo
// </copyright>
// <summary>
//   The treatment maintenance domain service
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Domain.StudyDefinition.Services
{
    #region

    using System;

    using Domain.StudyDefinition.Contracts.DomainServices;
    using Domain.StudyDefinition.Contracts.Repositories.Treatments;
    using Domain.StudyDefinition.Entities;

    #endregion

    /// <summary>
    /// The treatment maintenance domain service
    /// </summary>
    public class TreatmentMaintenanceDomainService : ITreatmentMaintenanceDomainService
    {
        #region Constants and Fields

        /// <summary>
        /// The treatment repository instance.
        /// </summary>
        private readonly ITreatmentRepository treatmentRepositoryInstance;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TreatmentMaintenanceDomainService"/> class.
        /// </summary>
        /// <param name="treatmentRepository">
        /// The treatment repository.
        /// </param>
        public TreatmentMaintenanceDomainService(
            ITreatmentRepository treatmentRepository)
        {
            if (treatmentRepository == null)
            {
                throw new ArgumentNullException("treatmentRepository");
            }

            this.treatmentRepositoryInstance = treatmentRepository;
        }

        #endregion

        #region Implemented Interfaces

        #region ITreatmentMaintenanceDomainService

        /// <summary>
        /// Deletes the specified Treatment.
        /// </summary>
        /// <param name="treatment">
        /// The Treatment to delete.
        /// </param>
        public void DeleteTreatment(Treatment treatment)
        {
            this.treatmentRepositoryInstance.Delete(treatment);
        }

        /// <summary>
        /// Updates the specified Treatment.
        /// </summary>
        /// <param name="treatment">
        /// The Treatment to update.
        /// </param>
        public void UpdateTreatment(Treatment treatment)
        {
            this.treatmentRepositoryInstance.Update(treatment);
        }

        #endregion

        #endregion
    }
}